<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateNotUploadQuestion extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('not_upload_question', ['comment' => '固化平台未上传固话问卷原因说明表']);
        $table
            ->addColumn('user_id', 'integer', array('limit' => 30, 'default' => 0, 'comment' => '用户id'))
            ->addColumn('unit_id', 'integer', array('limit' => 30, 'default' => 0, 'comment' => '网点id'))
            ->addColumn('img_json', 'json', array('null' => true, 'comment' => 'json图片'))
            ->addColumn('content', 'text', array('null' => true, 'comment' => '未上传原因内容'))
            ->addColumn('status', 'boolean', array('limit' => 1,  'default' => 0, 'comment' => '状态（0or1上级审核,2最终审核）'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();


        $table = $this->table('not_upload_question_log', ['comment' => '固化平台未上传固话问卷原因说明表审核日志表']);
        $table
            ->addColumn('not_upload_question_id', 'integer', array('limit' => 30, 'default' => 0, 'comment' => '问卷id'))
            ->addColumn('parent_unit_id', 'integer', array('limit' => 30, 'default' => 0, 'comment' => '父级id 审核用'))
            ->addColumn('status', 'boolean', array('limit' => 1,  'default' => 0, 'comment' => '状态（0or1上级审核,2最终审核）'))
            ->create();
    }
}
